import 'dart:convert';

AddressListModel collectionsModelFromJson(String str) => AddressListModel.fromJson(json.decode(str));

String collectionsModelToJson(AddressListModel data) => json.encode(data.toJson());

class AddressListModel {
  int code;
  String ? msg;
  List<AddressData> data;

  AddressListModel({
    required this.code,
    this.msg,
    required this.data,
  });

  factory AddressListModel.fromJson(Map<String, dynamic> json) => AddressListModel(
    code: json["code"],
    msg: json["msg"],
    data: List<AddressData>.from(json["data"].map((x) => AddressData.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "msg": msg,
    "data": List<dynamic>.from(data.map((x) => x.toJson())),
  };
}

class AddressData {
  int id;
  int uid;
  String consignee;
  String phone;
  String detail;
  int isDefault;

  AddressData({
    required this.id,
    required this.uid,
    required this.consignee,
    required this.phone,
    required this.detail,
    required this.isDefault,
  });

  factory AddressData.fromJson(Map<String, dynamic> json) => AddressData(
      id: json["id"],
      uid: json["uid"],
      consignee: json["consignee"],
      phone: json["phone"],
      detail: json["detail"],
      isDefault: json["isDefault"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "uid,": uid,
    "consignee": consignee,
    "phone": phone,
    "detail": detail,
    "isDefault": isDefault,
  };
}
